package architect.springcloud.feign.security;

import feign.auth.BasicAuthRequestInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;

/**
 * 服务提供者认证配置类
 *
 * @author guanxin
 * @date 2018/4/19 16:03
 */

@Configuration
public class BasicAuthConfiguration {

    @Value("${service.provider.username}")
    private String username;

    @Value("${service.provider.password}")
    private String password;

    @Bean
    public BasicAuthRequestInterceptor basicAuthorizationInterceptor() {
        return new BasicAuthRequestInterceptor(username, password);
    }
}
